
App({
  onLaunch() {
    // console.log('小程序初始化')
  },
  onShow() {
    // console.log(this.getData())
    // console.log('小程序 show')
  },
  onHide() {
    // console.log('小程序 hide')
  },
  getData() {
    return 'hello app'
  },
  http({method = 'GET', url, data = {}} = {}) {
    return new Promise((resolve, reject) => {
      wx.request({
        method,
        url,
        data,
        success(res) {
          if (res.data.status === 100){
            resolve(res.data)
          } else {
            reject(res)
          }
        }
      })
    })
  }
})

